<?php include('header.php'); ?>
<aside id="side-nav" class="span3">
	<?php include 'side.php'; ?>
</aside>
<?php
	 $con = mysql_connect("localhost", "group5", "group5");
    if(!$con)
    {
                echo "Connection failed!";
        exit;
    }
	
	mysql_select_db("group5");
	
	$userId = $_SESSION['userId'];
				
	$query = mysql_query("SELECT DISTINCT title, workshopDescription, workshopSessionId, meetingDay, 
			meetingTime, bldgName, bldgNum, roomNumber 
			FROM building, room, workshop, workshop_sessions, users
			WHERE instructorId = userId
			AND workshop.workshopId = workshop_sessions.workshopId
			AND room.roomId = workshop_sessions.roomId
			AND building.bldgId = room.bldgId
			AND userId = userId", $con);
?>
<div class="span9 content-container">
        <div id="content-window" class="content">
          <h3>Teaching Sessions</h3>
		<form method="post">
		<table class="table table-condensed table-striped table-bordered">
			<?php 	
				if(mysql_num_rows($query) > 0){
			?>
			<tr>
				<th>Workshop Session</th>
				<th>Description</th>
				<th>Building</th>
				<th>Room Location</th>
				<th>Day</th>
				<th>Time</th>
			</tr>
			<?php
				while($row = mysql_fetch_assoc($query)){ 
			?>
			<tr>
				<td><?php echo $row['title'];?></td>
				<td><?php echo $row['workshopDescription']; ?></td>
				<td><?php echo $row['bldgName'] . " " . $row['bldgNum']; ?></td>
				<td><?php echo $row['roomNumber']; ?></td>
				<td><?php echo $row['meetingDay']; ?></td>
				<td><?php echo $row['meetingTime']; ?></td>
			<?php }
				}else{ 
			?>
				<td colspan="8" style="color: red; text-align: center"><p >You aren't instructing any workshop sessions.</p></td>
			<?php } ?>
		</table>
		</form>
<?php mysql_close($con);?>
</div> <!-- end .content -->
</div> <!-- end .content-container -->
<?php include('footer.php'); ?>
